#include "PCFG.h"
#include <chrono>
#include <fstream>
#include "md5.h"
#include <iomanip>
using namespace std;
using namespace chrono;

// 编译指令如下：
// g++ correctness.cpp train.cpp guessing.cpp md5.cpp -o main
// g++ correctness.cpp md5.cpp -o correctness && ./correctness

// 通过这个函数，你可以验证你实现的SIMD哈希函数的正确性
int main()
{
    /*bit32 state[4];
    MD5Hash("bvaisdbjasdkafkasdfnavkjnakdjfejfanjsdnfkajdfkajdfjkwanfdjaknsvjkanbjbjadfajwefajksdfakdnsvjadfasjdvabvaisdbjasdkafkasdfnavkjnakdjfejfanjsdnfkajdfkajdfjkwanfdjaknsvjkanbjbjadfajwefajksdfakdnsvjadfasjdvabvaisdbjasdkafkasdfnavkjnakdjfejfanjsdnfkajdfkajdfjkwanfdjaknsvjkanbjbjadfajwefajksdfakdnsvjadfasjdvabvaisdbjasdkafkasdfnavkjnakdjfejfanjsdnfkajdfkajdfjkwanfdjaknsvjkanbjbjadfajwefajksdfakdnsvjadfasjdva", state);
    for (int i1 = 0; i1 < 4; i1 += 1)
    {
        cout << std::setw(8) << std::setfill('0') << hex << state[i1];
    }
    cout << endl;*/
    // bba46eb8b53cf65d50ca54b2f8afd9db

    /*string inputs[4] = {
        "bvaisdbjasdkafkasdfnavkjnakdjfejfanjsdnfkajdfkajdfjkwanfdjaknsvjkanbjbjadfajwefajksdfakdnsvjadfasjdvabvaisdbjasdkafkasdfnavkjnakdjfejfanjsdnfkajdfkajdfjkwanfdjaknsvjkanbjbjadfajwefajksdfakdnsvjadfasjdvabvaisdbjasdkafkasdfnavkjnakdjfejfanjsdnfkajdfkajdfjkwanfdjaknsvjkanbjbjadfajwefajksdfakdnsvjadfasjdvabvaisdbjasdkafkasdfnavkjnakdjfejfanjsdnfkajdfkajdfjkwanfdjaknsvjkanbjbjadfajwefajksdfakdnsvjadfasjdva",
        "bvaisdbjasdkafkasdfnavkjnakdjfejfanjsdnfkajdfkajdfjkwanfdjaknsvjkanbjbjadfajwefajksdfakdnsvjadfasjdvabvaisdbjasdkafkasdfnavkjnakdjfejfanjsdnfkajdfkajdfjkwanfdjaknsvjkanbjbjadfajwefajksdfakdnsvjadfasjdvabvaisdbjasdkafkasdfnavkjnakdjfejfanjsdnfkajdfkajdfjkwanfdjaknsvjkanbjbjadfajwefajksdfakdnsvjadfasjdvabvaisdbjasdkafkasdfnavkjnakdjfejfanjsdnfkajdfkajdfjkwanfdjaknsvjkanbjbjadfajwefajksdfakdnsvjadfasjdva",
        "bvaisdbjasdkafkasdfnavkjnakdjfejfanjsdnfkajdfkajdfjkwanfdjaknsvjkanbjbjadfajwefajksdfakdnsvjadfasjdvabvaisdbjasdkafkasdfnavkjnakdjfejfanjsdnfkajdfkajdfjkwanfdjaknsvjkanbjbjadfajwefajksdfakdnsvjadfasjdvabvaisdbjasdkafkasdfnavkjnakdjfejfanjsdnfkajdfkajdfjkwanfdjaknsvjkanbjbjadfajwefajksdfakdnsvjadfasjdvabvaisdbjasdkafkasdfnavkjnakdjfejfanjsdnfkajdfkajdfjkwanfdjaknsvjkanbjbjadfajwefajksdfakdnsvjadfasjdva",
        "bvaisdbjasdkafkasdfnavkjnakdjfejfanjsdnfkajdfkajdfjkwanfdjaknsvjkanbjbjadfajwefajksdfakdnsvjadfasjdvabvaisdbjasdkafkasdfnavkjnakdjfejfanjsdnfkajdfkajdfjkwanfdjaknsvjkanbjbjadfajwefajksdfakdnsvjadfasjdvabvaisdbjasdkafkasdfnavkjnakdjfejfanjsdnfkajdfkajdfjkwanfdjaknsvjkanbjbjadfajwefajksdfakdnsvjadfasjdvabvaisdbjasdkafkasdfnavkjnakdjfejfanjsdnfkajdfkajdfjkwanfdjaknsvjkanbjbjadfajwefajksdfakdnsvjadfasjdva"
    };
    bit32 states[4][4];
    MD5HashParallel(inputs, states);
    for (int i = 0; i < 4; i += 1)
    {
        for (int i1 = 0; i1 < 4; i1 += 1)
        {
            cout << std::setw(8) << std::setfill('0') << hex << states[i][i1];
        }
        cout << endl;
    }*/
    /*bba46eb8b53cf65d50ca54b2f8afd9db
      bba46eb8b53cf65d50ca54b2f8afd9db
      bba46eb8b53cf65d50ca54b2f8afd9db
      bba46eb8b53cf65d50ca54b2f8afd9db*/

    string inputs[4] = {
       "kaitlyn",
       "leahnbilliem8s4eva",
       "erwinbeverly27",
       "genebaby1"
    };
    bit32 states[4][4];
    MD5HashParallel(inputs, states);
    for (int i = 0; i < 4; i += 1)
    {
        for (int i1 = 0; i1 < 4; i1 += 1)
        {
            cout << std::setw(8) << std::setfill('0') << hex << states[i][i1];
        }
        cout << endl;
    }
    /*73ac9896b3f22bf0307b19130810e5e5
      621d1c0c9b585d85f3296e03ffb514a6
      4b620e0eee0eeca4a74f85745b4529a9
      a3165ea60ad567cb37dd7fc4e27c5d06*/

    /*bit32 state[4];
    for (int i = 0; i < 4; i += 1)
    {
        MD5Hash(inputs[i], state);
        for (int i1 = 0; i1 < 4; i1 += 1)
        {
            cout << std::setw(8) << std::setfill('0') << hex << state[i1];
        }
        cout << endl;
    }*/
    /*73ac9896b3f22bf0307b19130810e5e5
      621d1c0c9b585d85f3296e03ffb514a6
      4b620e0eee0eeca4a74f85745b4529a9
      a3165ea60ad567cb37dd7fc4e27c5d06*/
}